<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="http://www.tag.com/website" %>

<!-- 优惠券弹出层 -->
<article class="coupon-popup-in" style="display: none;">
    <section class="popup-title">
        <span>领取优惠券</span>
        <a class="close" href="javascript:;"></a>
    </section>
    <section class="coupon-list">
        <ul>
            <c:forEach items="${coupons}" var="coupon">
                <li>
                    <article class="fl">
                        <section class="arch-price fl">￥<span>${coupon.offerMoney}</span></section>
                        <section class="arch-msg fl">
                            <p class="msg-txt1">${coupon.name}</p>
                            <p class="msg-txt2">满${coupon.minMoney}可使用</p>
                        </section>
                        <div class="cl"></div>
                        <section class="arch-time">有效期：<s:date value="${coupon.startDate}"/> - <s:date
                                value="${coupon.endDate}"/></section>
                    </article>
                    <a id="click${coupon.id}" class="arch-btn fr" href="javascript:getCoupon(${coupon.id});">
                        <span id="text${coupon.id}">立即领取</span>
                    </a>
                    <div class="cl"></div>
                </li>
            </c:forEach>
        </ul>
    </section>
</article>
<script type="application/javascript">
    function getCoupon(id) {
        $w.httpRequest({
            url: ctx + "/we/coupon/receive/" + id,
            ok: function (ret) {
                if (!ret.Data) {
                    $("#text" + id).text("已领取");
                    $("#click" + id).attr("href", "javascript:void(0);");
                }
                new auiToast().success({
                    title: "领取成功",
                    duration: 300
                });
            }
        })
    }
</script>

